The invention relates to a resonant device comprising an electromechanical resonator of nanometric or micrometric size comprising a mobile element and a fixed element, detection means providing detection signals representative of movement of the mobile element with respect to the fixed element to a feedback loop connected to an excitation input of the resonator.